package com.example.demo.mapper;

import com.example.demo.entity.Stadium;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StadiumMapper {
    @Select("select * from stadiums")
    List<Stadium> findAllStadiums();

    @Select("select * from stadiums where id=#{s_id}")
    Stadium findStadiumById(int s_id);

    @Select("select * from stadiums where number=#{number}")
    Stadium findStadiumByNumber(String number);

    @Select("select * from stadiums where type=#{type}")
    List<Stadium> findStadiumByType(String type);

    @Select("select s_id from stadiums where number = #{number}")
    List<Integer> findStadiumIdByNumber(Stadium stadium);
    @Insert("insert into  stadiums(type, number) values (#{type}, #{number})")
    int addStadium(Stadium stadium);

    @Delete("delete from stadiums where s_id=#{s_id}")
    int deleteStadium(int s_id);
}
